package com.yicheng.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yicheng.dao.NewsDao;
import com.yicheng.entity.News;
import com.yicheng.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewsServiceImpl extends ServiceImpl<NewsDao, News> implements NewsService{

    @Autowired
    private NewsDao newsDao;

    @Override
    public List<News> getNews() {
        LambdaQueryWrapper<News> lwq = new LambdaQueryWrapper<>();
        lwq.orderBy(true,false,News::getDate);
        return newsDao.selectList(lwq);
    }
}
